/**
 * 
 */
package org.jenkon.commons.io.filter;

import java.io.FileFilter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Abstract condition {@link FileFilter} class.
 * 
 * @author Jens Konopka
 * 
 */
abstract class AbstractConditionFileFilter implements FileFilter, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2764453686561364194L;

	private final List<FileFilter> filters = new ArrayList<FileFilter>();

	/**
	 * initialize constructor.
	 */
	public AbstractConditionFileFilter() {
		this(new ArrayList<FileFilter>());
	}

	/**
	 * @param filters {@link List} with delegating {@link FileFilter}
	 */
	public AbstractConditionFileFilter(final List<FileFilter> filters) {
		this.add(filters);
	}

	/**
	 * @param filter delegating filter to add
	 */
	public void add(final FileFilter filter) {
		getFilters().add(filter);
	}

	/**
	 * @param filters {@link List} with delegating {@link FileFilter}
	 */
	public void add(final List<FileFilter> filters) {
		getFilters().addAll(filters);
	}

	/**
	 * @return the filters
	 */
	protected final List<FileFilter> getFilters() {
		return filters;
	}
}
